﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LiveSequence.Suite.Patterns
{
  public class Singleton<T> where T : class, new()
  {
    private static object _syncobj = new object(); 
    private static volatile T _instance = null; 
    public static T Instance
    {
      get
      {
        if (_instance == null)
        {
          lock (_syncobj)
          {
            if (_instance == null)
            {
              _instance = new T();
            }
          }
        } return _instance;
      }
    } protected Singleton() { }
  }
}
